<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>{$title}-{$sys.name}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="{$sys.key}">
    <meta name="description" content="{$sys.des}">
    <link rel="shortcut icon" href="/favicon.ico"/>  
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="/static/user/css/main_wap.css">
    <link rel="stylesheet" href="/static/common/css/font.css" media="all">  
</head>

<script src="/static/plugins/layui/layui.js"></script> 
<script src='https://cdn.bootcss.com/socket.io/2.0.3/socket.io.js'></script>  
<script type="text/javascript">
function playv(){
    //消息提示音
    var audio = document.createElement("audio");
    if (audio.canPlayType("audio/mp3")) {
        audio.src = "/static/default.mp3";
    }else if(audio.canPlayType("audio/ogg")) {
        audio.src = "/static/default.ogg";
    } 
    audio.play();//消息提示音 END    
}
// 订单消息同步通知 
var socket = io('http://'+document.domain+':2120');   // 连接服务端
socket.on('new_msg', function(msg){ // 后端推送来消息时            
    arr=msg.split("|");
    var m_userid=arr[0];
    var m_agentid=arr[1];
    var userid="{$userInfo.id}"; 
    var voice="{$userInfo.voice}"; 
    if(m_userid!='0' && m_userid==userid){                
        layer.msg("您有新订单提醒",{time:2000,icon:1},function(){   
            location.href ="{:url('user/order/index')}"; 
        });     
        if(voice=='open'){
            playv();
        }  
    }
    if(m_agentid!='0' && m_agentid==userid){             
        layer.msg("您有新的代理订单提醒",{time:2000,icon:1},function(){  
            location.href ="{:url('user/agent/orderlist')}"; 
        });          
        if(voice=='open'){
            playv();
        }  
    } 
});  
</script>
